Skip to content

Conversation

@lawofcycles
Copy link

Description

This PR fixes a NullPointerException that occurs when restoring remote snapshots when shard size information is not available in the ClusterInfo cache.

The validateSearchableSnapshotRestorable method in RestoreService attempts to calculate the total size of existing remote snapshot shards.
When ClusterInfo.getShardSize() returns null (which is valid behavior when shard size info is unavailable), the stream operation mapToLong(Long::longValue) throws a NullPointerException.

Related Issues

Resolves #19349

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@lawofcycles lawofcycles requested a review from a team as a code owner October 19, 2025 09:05
@github-actions github-actions bot added bug Something isn't working Storage:Snapshots labels Oct 19, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for c2f7eb8: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@lawofcycles
Copy link
Author

The CI failure appears to be unrelated to my changes. The error is occurring in the Azure fixture Docker containers:

ERROR: for azure-fixture_azure-fixture-repositories-metering_1  cannot stop container: 
container PID is zombie and can not be killed

This seems to be an infrastructure/flaky test issue rather than a problem with the NPE fix in RestoreService.

@lawofcycles lawofcycles force-pushed the fix-19349-npe-restore-remote-snapshot branch from 8eacfc4 to 2baa1ab Compare October 19, 2025 18:19
@github-actions
Copy link
Contributor

❌ Gradle check result for 2baa1ab: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-project-automation github-project-automation bot moved this to 👀 In review in Storage Project Board Oct 20, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for 2baa1ab: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Member

@sandeshkr419 sandeshkr419 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this.

LGTM with a small rename suggestion. Can you please address this and rebase.

@github-actions
Copy link
Contributor

❌ Gradle check result for e76f134: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@lawofcycles lawofcycles force-pushed the fix-19349-npe-restore-remote-snapshot branch from 7ac1b80 to 70f49a0 Compare October 24, 2025 23:35
@lawofcycles
Copy link
Author

Apologies for the force push confusion. I accidentally included unrelated commits while cleaning up the merge commit, which notified many code owners unnecessarily.
PR is now properly rebased, so please check for merge.
Thanks

@github-actions
Copy link
Contributor

✅ Gradle check result for 70f49a0: SUCCESS

@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 21.42857% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.17%. Comparing base (cb9c30b) to head (70f49a0).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../java/org/opensearch/snapshots/RestoreService.java 21.42% 8 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19684      +/-   ##
============================================
+ Coverage     73.12%   73.17%   +0.04%     
+ Complexity    70973    70969       -4     
============================================
  Files          5737     5737              
  Lines        324767   324775       +8     
  Branches      46982    46985       +3     
============================================
+ Hits         237483   237643     +160     
+ Misses        68151    67985     -166     
- Partials      19133    19147      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Storage:Snapshots

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

[BUG] NullPointerException when creating remote index from snapshot

3 participants